package com.matrix.java.chap_05;

import java.util.Scanner;

/*
    找出两个分教最高的学生
 */
public class Ex5_09 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("学生个数: ");
        int stuNum = input.nextInt();
        int maxScore = 0;
        int secondMaxScore = 0;
        String stuName = " ";
        String secondStuName = " ";
        for (int i = 0; i < stuNum; i++) {
            System.out.print("学生名: ");
            String name = input.next();
            System.out.print("学生分数: ");
            int score = input.nextInt();
            if (score > maxScore) {
                secondStuName =stuName;
                secondMaxScore=maxScore;
                maxScore = score;
                stuName = name;

            }
        }
        System.out.println(stuName + " " + maxScore);
        System.out.println(secondStuName + " " + secondMaxScore);
        input.close();
    }
}
